Skip to content

Add wind, falling tiles, lifts, and drawbridges - #21

Merged
beetlebugorg merged 1 commit into
level-filesfrom
hazards
Dec 4, 2026
Merged

beetlebugorg merged 1 commit into
level-filesfrom
hazards

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

Closes #5. Based on #20.

Four hazards of a hill town at night, in core/hazards.tcl. Each one is a function of the frame count, so the same inputs give the same frames:

  • Wind {x0 x1 force period}: a gust for the first half of each period pushes the hero by force pixels a frame between x0 and x1. Streaks show it.
  • Falling tile {x y0 period}: a shadow on the floor for 40 frames, then a tile falls at 4 pixels a frame to the top of the block under x. A tile that touches the hero hurts it, as the water does (event tilehit).
  • Lift {x0 y0 x1 y1 period}: a floor on a rope that goes from y0 to y1 and back on a cosine. The hero on it rides it (h(lift)). The level check needs a period of at least 2 times the distance.
  • Drawbridge {x0 y x1 period}: a floor that is down for the first half of each period and up for the second half.

Levels 6 to 10 use them: a tile and a wind on Rooftops, a drawbridge on The Canal, a lift and a third lamp on Market Square, a wind on Old Wall, and a tile on Lantern Hill. tools/solve.tcl keys a node with the frame count in a street with a moving part, and found a new route for each of the 5 levels. The levels of 0.1.0 have no hazard, and their routes replay as before. The push of a street with no wind is the integer 0, so the old frames stay the same bit for bit.

What ran here: ztcl test (105 tests pass, 13 new in tests/hazards.test: each hazard, the errors of the level check, and a test that the same inputs give the same frames), tests/tk/smoke.tcl and tests/tk/save.tcl with ztk 1.0.0-beta.8 headless, and captures of the hazards. What did not run: a person who plays the new hazards by hand, the web build with this change, and a phone.

core/hazards.tcl gives each hazard as a function of the frame count,
so a level plays the same each time. step rides a lift, adds the push
of a gust, and hurts the hero under a falling tile. Levels 6 to 10
use them, with new routes from tools/solve.tcl.
@beetlebugorg beetlebugorg added this to the v0.2.0 milestone Dec 4, 2026
@beetlebugorg
beetlebugorg merged commit 0134dce into level-files Dec 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant